package com.sts.transform.function;

import cn.hutool.core.util.RandomUtil;
import com.googlecode.aviator.runtime.function.AbstractVariadicFunction;
import com.googlecode.aviator.runtime.type.AviatorObject;
import com.googlecode.aviator.runtime.type.AviatorString;

import java.util.Map;

/**
 * @author lsl
 * @since 2025年07月09日 19:57
 */
public class RandEleFunction extends AbstractVariadicFunction {

    @Override
    public AviatorObject variadicCall(Map<String, Object> map, AviatorObject... aviatorObjects) {
        return new AviatorString(String.valueOf(RandomUtil.randomEle(aviatorObjects).getValue(map)));
    }

    @Override
    public String getName() {
        return "randEle";
    }
}